{% extends "base.html" %}

{% block content %}
    <h1 class="mb-4">组会学习资料</h1>
    
    {% if error %}
    <div class="alert alert-danger">{{ error }}</div>
    {% endif %}
    
    {% if not user %}
    <div class="alert alert-info">
        请<a href="/login">登录</a>或<a href="/register">注册</a>以查看和添加学习资料
    </div>
    {% else %}
    <div class="row">
        {% for meeting in meetings %}
        <div class="col-md-6 mb-4">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">{{ meeting.title }}</h5>
                    <h6 class="card-subtitle mb-2 text-muted">日期: {{ meeting.date }} | 类型: {{ meeting.template_type }}</h6>
                    <p class="card-text">{{ meeting.content[:200] }}{% if meeting.content|length > 200 %}...{% endif %}</p>
                    <div class="d-flex justify-content-between">
                        <small class="text-muted">添加者: {{ meeting.author.username if meeting.author else '未知' }}</small>
                        <small class="text-muted">{{ meeting.created_at.strftime('%Y-%m-%d %H:%M') }}</small>
                    </div>
                </div>
            </div>
        </div>
        {% endfor %}
    </div>
    {% endif %}
{% endblock %}
